package com.trimps.wifi.web;

import javax.servlet.ServletContextEvent;

import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;

import com.trimps.wifi.common.ApplicationContextManager;


/** 
 *重写Spring自定义的listener，扩展其初始化方法，主要做一些系统启动前的准备工作.
 * @author kzw1989@163.com
 *
 * 2010-5-5  create
 */
public class WebContextListener extends ContextLoaderListener {
		

	@Override
	public void contextInitialized ( ServletContextEvent sce )
	{
		super.contextInitialized(sce);
		ApplicationContextManager.setApplicationContext((WebApplicationContext) sce.getServletContext().
				getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE));
		
	}
	
	@Override
	public void contextDestroyed(ServletContextEvent event) {
	}
}
